home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 476-500 / disk_484 / ezasm / ezasm.doc < prev    next >
Text File  |  1992-05-06  |  23KB  |  1,035 lines

  1.  
  2.  
  3.     EZAsm   Version 1.5         March '91   by Joe Siebenmann
  4.  
  5.  
  6.     DISCLAIMER:
  7.  
  8.     The following only applies to EZAsm, ez.lib, funcnm, funcdat,
  9.     and related .doc files.  ( A68k & Blink have their own
  10.     distribution policies )
  11.  
  12.     You have the right to freely use, copy and distribute this program
  13.     as long as the following conditions are met:
  14.  
  15.     1.    The documentation is included with the program, and neither
  16.         is modified in any way.
  17.  
  18.     2.    The program is not included in any package for profit
  19.         unless written consent from the author is obtained.
  20.  
  21.     NOTE: The author does not accept any responsibility for any damage
  22.            that might result from the use of this program.
  23.  
  24.  
  25.  
  26.         EZAsm was written to make programming in 68000 assembly
  27.     language much easier!  EZAsm combines parts of "C" with
  28.     68000 assembly, giving it the "feel" of a higher level language.
  29.     The resulting code is optimized as much as possible.
  30.  
  31.     A68k ( by Charlie Gibbs ) and Blink ( from The Software Distillery )
  32.     are now included, and the offsets for all the 1.3 functions are
  33.     now internal, so you'll have everything you need to start
  34.     producing executables.
  35.  
  36.  
  37. Here are some of its advantages:
  38.  
  39.  
  40. o    Your code is converted into the fastest possible
  41.     assembly statement(s), so you automatically write
  42.     "good" code.
  43.  
  44. o    More structured.  Compare and bit test statements can have
  45.     braces and "else" like "C".  Being able to use braces lets
  46.     you use assembly in a whole new way!
  47.  
  48. o    "C" like Amiga function calls!  Every 1.3 function in every
  49.     library is supported.  An XREF table is automatically
  50.     built and inserted if needed.
  51.  
  52. o    Makes code much more readable.  You can code nearly
  53.     twice as fast, with fewer syntax errors.    
  54.  
  55. o    No more having to constantly look up which condition code to    
  56.     use for compares, bit tests, or maximum numbers for
  57.     "moveq" or "addq" etc.
  58.  
  59. o    You can insert normal assembly statements anywhere, for your
  60.     special needs.
  61.  
  62.  
  63.  
  64.         You need to know a little about assembly language
  65.     and "C" operators before you dive right in.  If you're new to
  66.     68000 assembly language, I suggest looking at one of the
  67.     many available books on the subject.  The included example
  68.     source programs can give you a good idea about:
  69.  
  70.  
  71. o    General statement syntax.
  72.  
  73. o    Use of "l", "w", "b" size arguments.
  74.  
  75. o    Using assembly statements in your code.
  76.  
  77.  
  78. ****************************************    
  79.  
  80. Using EZAsm:
  81.  
  82.     1.  Create a directory, and copy these files into it:
  83.  
  84.         ezasm, A68k, Blink, make1, ez.lib, funcnm, funcdat
  85.  
  86.     2.  Cd into your new directory, and you're ready to go!
  87.  
  88.     ( Another good method is to create an ALIAS to load these
  89.     files into VD0: and work from there )
  90.  
  91.  
  92. Make1
  93.  
  94.     Make1 is a "make" like program, written in EZAsm, that will
  95.     Execute() the necessary programs for you, creating an
  96.     executable file with a minimum of effort.  The source code
  97.     is included.
  98.  
  99.  
  100.         make1 [file]    ( No extension.  [file] is the
  101.                 filename with path if needed )
  102.  
  103.  
  104.         Execute()'s these commands:
  105.  
  106.  
  107.         ezasm [file].s
  108.         a68k [file].asm
  109.         blink FROM [file].o LIBRARY ez.lib TO [file]
  110.  
  111.  
  112. EZAsm [path]file.s
  113.  
  114.     Where file is the name of your source file including
  115.     any path.  Give your source file an extension ( .s etc. )
  116.     or your linker will overwrite it.
  117.  
  118.     It produces an output file called file.asm.
  119.  
  120.     If you use other assemblers or linkers on the final output file,
  121.     you may need to change the extension from .asm to .a etc..
  122.     A68k supports Manx's "CSEG" & "DSEG" which I like to use.
  123.     You may need to change these to "SECTION name,CODE" etc. if
  124.     using other assemblers.  The code section has been made as
  125.     compatible as possible.  If your assembler complains, it's
  126.     usually something in your data section.
  127.  
  128.  
  129.  
  130. Manx:
  131.         ezasm scroll.s   ( c.lib supplies offsets )
  132.         as scroll.asm
  133.         ln scroll.o -lc
  134.  
  135.  
  136.  
  137. *********************************
  138. *        Operand  Table         *
  139. *********************************
  140.  
  141.               Operand Type
  142.  
  143. Mode     [A] [B] [C] [D] [E] [F]
  144.  
  145. Dn        *   *   *   -   *   -
  146. An        *   -   *   -   -   -
  147. (An)      *   *   *   *   *   *
  148. (An)+     *   *   *   *   *   *
  149. -(An)     *   *   *   *   *   *
  150. d(An)     *   *   *   *   *   *
  151. d(An,Xn)  *   *   *   *   *   *
  152. abs.w     *   *   *   *   *   *
  153. abs.l     *   *   *   *   *   *
  154. d(PC)     *   -   -   -   *   *
  155. d(PC,Xn)  *   -   -   -   *   *
  156. immediate *   -   -   -   *   -
  157.  
  158.  
  159. declared variables:
  160.  
  161. "foo"  becomes  "foo(a5)"  ( d(An) )
  162.  
  163. **************************************
  164.  
  165.       ( decimal or hex )
  166.  
  167. #<1>    1 - 8
  168. #<2>    0 - 7
  169. #<3>    0 - 31
  170. #<4>    -128 - 127
  171. #<any>    any byte, word, or long size number
  172.  
  173.  
  174. Dn    d0 - d7
  175. An    a0 - a7
  176.  
  177.  
  178. {B}    byte data size not allowed for An operands
  179.  
  180.  
  181. ********************************************
  182. *      legal      *  converted   *  legal  *
  183. *     operands    *     to       *  sizes  *
  184. ********************************************
  185.  
  186. Addition  Subtraction
  187.  
  188. ++
  189. --
  190.  
  191.     [C] <op>        addq/subq       L,W,{B}
  192.  
  193. +=
  194. -=
  195.     
  196.      Dn <op> [A]    add/sub         L,W,B        
  197.  
  198.     [D] <op> Dn     add/sub         L,W,B
  199.  
  200.      An <op> [A]    adda/suba       L,W
  201.     
  202.     [B] <op> #<any> addi/subi       L,W,B        
  203.     
  204.     [C] <op> #<1>   addq/subq       L,W,{B}    
  205.  
  206.  
  207. Examples:
  208.  
  209.     Total ++    
  210.     d1 += 10
  211.  
  212. Optional Args:
  213.  
  214.     l, w, b 
  215.  
  216. **********************************
  217.  
  218. Multiplication   Division
  219.  
  220.  
  221. *=
  222.  
  223.     Dn *= [E]       mulu            W
  224.  
  225.     Dn *= ##   *                    W
  226.  
  227.  
  228. /=
  229.  
  230.     Dn /= [E]       divu            W
  231.     
  232.  
  233. Examples:
  234.  
  235.     d0 *= d1
  236.     d2 /= 2
  237.  
  238. Optional Args:
  239.  
  240.     w,
  241.     s ( signed  divs/muls )
  242.  
  243.  
  244. *    This optimization results in code that's larger then "mulu"
  245.     or "muls", but will execute much faster.  Not all numbers
  246.     can be optimized.  If the number doesn't work, "mulu"
  247.     or "muls" will be used, and the size will default to WORD.
  248.     You can use a LONG, but if "mulu", or "muls" is used,
  249.     it'll be truncated to a WORD.  
  250.  
  251.     ( where ## is a word or byte length number )
  252.  
  253.  
  254. **********************************
  255.  
  256. And   Or   Exclusive Or
  257.  
  258.  
  259. &=
  260. |=
  261.  
  262.     [B] <op> #<any>     andi/ori        L,W,B    
  263.     
  264.      Dn <op> [E]        and/or          L,W,B
  265.     
  266.     [D] <op> Dn         and/or          L,W,B
  267.  
  268.  
  269. x=
  270.  
  271.     [B] x= Dn           eor             L,W,B    
  272.     
  273.     [B] x= #<any>       eori            L,W,B
  274.  
  275.  
  276. Examples:
  277.  
  278.     Mask &= %11010000
  279.     Flags |= $f0
  280.  
  281. Optional Args:
  282.  
  283.     l, w, b 
  284.  
  285. ***********************************
  286.  
  287. Shift  Left/Right
  288.  
  289.  
  290. <<
  291. >>
  292.  
  293.      Dn <op> Dn     lsl/lsr         L,W,B
  294.     
  295.      Dn <op> 1-31 * lsl/lsr         L
  296.  
  297.      Dn <op> 1-8    lsl/lsr         L,W,B
  298.     
  299.     [D] <op> 1      lsl/lsr         W
  300.  
  301.  
  302. Examples:
  303.  
  304.     d2 << d0
  305.     d1 >> 4
  306.  
  307. Optional Args:
  308.  
  309.     l, w, b,
  310.     a ( arithmetic shift  asl/asr )
  311.  
  312.  
  313. *    Normally you're limited to shifting 1-8, or using a
  314.     data register to hold higher.  This optimized version
  315.     is faster, and saves using a data register!
  316.     ( logical shift only )
  317.  
  318.     
  319. ***********************************
  320.  
  321. Assign
  322.  
  323.  
  324. =    
  325.  
  326.     [B] = [A]    move            L,W,{B}
  327.     
  328.      An = [A]    movea           L,W
  329.     
  330.      Dn = #<4>   moveq           L
  331.  
  332.  
  333. Examples:
  334.  
  335.     temp = Total
  336.     (a1)+ = 0 w
  337.  
  338. Optional Args:
  339.  
  340.     l, w, b 
  341.  
  342. ***********************************
  343.  
  344. Compare
  345.  
  346.  
  347. >=
  348. <=
  349. !=
  350. >
  351. <
  352. =
  353.  
  354.      Dn <op> [A]      cmp          L,W,{B}
  355.     
  356.      An <op> [A]      cmpa         L,W
  357.     
  358.     [B] <op> #<any>   cmpi         L,W,B
  359.     
  360.   (An)+ <op> (An)+    cmpm         L,W,B
  361.  
  362.  
  363.  
  364. Syntax types:
  365.  
  366.  
  367.     [opr] <op> [opr] label
  368.  
  369.  
  370.  
  371.     [opr] <op> [opr] {
  372.         .
  373.         .
  374.     }
  375.  
  376.  
  377.  
  378.     [opr] <op> [opr] {
  379.         .
  380.         .
  381.     
  382.     } else {
  383.         .
  384.         .
  385.     }
  386.  
  387.  
  388. Examples:
  389.  
  390.     Total >= 100 Over
  391.  
  392.     Buf != 0 {
  393.         FreeMem( Buf 100 )
  394.     }
  395.  
  396.  
  397. Optional Args: ( placed AFTER label or brace )
  398.  
  399.     l, w, b,
  400.     s ( signed )
  401.  
  402.  
  403. ********************************************
  404.  
  405. Bit test
  406.  
  407.  
  408.  
  409.     Dn:0-31  =  0-1 label    btst.l     L
  410.     
  411.     Dn:Dn    =  0-1 label               L
  412.     
  413.     
  414.     [F]:0-7  =  0-1 label    btst.b     B    
  415.     
  416.     [F]:Dn   =  0-1 label               B
  417.  
  418.     
  419. ( You can also use braces instead of a label, see
  420. compare for use of braces )
  421.  
  422.  
  423. Examples:
  424.  
  425.     d1:0 = 1 CalcRtn
  426.  
  427.     ($bfe001):6 = 0 LMBDown
  428.  
  429.     d2:d0 = 1 {
  430.         rts
  431.     }
  432.  
  433.  
  434. Optional Args:
  435.  
  436.     ( ignored )
  437.     
  438. Rules:
  439.  
  440. o    No spaces inside first operand.
  441.  
  442. o    Only "=" is allowed.
  443.  
  444. o    Right operand can only be 0 or 1.
  445.  
  446.  
  447. ****************************************
  448.  
  449. Additional Arguments:
  450.  
  451.  
  452. b   forces operation to be byte
  453.  
  454. w     "       "        "   word
  455.  
  456. l     "       "        "   long
  457.  
  458. a    arithmetic shift       ( <<, >> )
  459.  
  460. s    signed                 ( *=, /=, compares )
  461.  
  462.  
  463. ( these are RESERVED and can't be used as variables, or labels
  464. ( unless you use upper case ) ) 
  465.  
  466. ******************************************************
  467.  
  468. Functions:
  469.  
  470.  
  471. Syntax examples:
  472.  
  473.     CloseWindow( Window )
  474.  
  475.     Buf = AllocMem( 512 $10001 )
  476.  
  477.     Permit( )
  478.  
  479.  
  480.  
  481. Example:
  482.  
  483. --------------------------------
  484.  
  485.  
  486. CLEAR_PUBLIC  equ  $10001
  487. OLD           equ  1005
  488.  
  489.  
  490.  
  491. LONG    _DosBase FHandle num Rbuf 
  492.  
  493.  
  494.     _DosBase = OpenLibrary( "dos.library" 0 ) 
  495.     beq     Exit
  496.  
  497.     Rbuf = AllocMem( 100 #CLEAR_PUBLIC )
  498.     beq  Exit
  499.  
  500.     FHandle = Open( "df0:myfile" #OLD )                 
  501.     beq  Exit
  502.  
  503.     d3 = 100    ; preload D3   *1
  504.     num = Read( d0 Rbuf * )
  505.  
  506.         .
  507.         .
  508.         .
  509.  
  510.  
  511. *1   normally you wouldn't need to do this, it's only an example..
  512.  
  513. ---------------------------------
  514.  
  515.  
  516. o    You must first do an OpenLibrary( ) to access functions in
  517.     a library.  Functions in ConsoleDevice are accessed 
  518.     differently, see the ConsoleDevice section in the RKM p 662.
  519.     ( load the io_Device field into "_ConBase" )
  520.     Functions in ExecBase are always accessible and don't
  521.     need to be opened.
  522.  
  523.     The library bases MUST be named:
  524.  
  525.  
  526.     _ConBase
  527.     _DiskfontBase
  528.     _DosBase
  529.     _ExpansionBase
  530.     _GfxBase
  531.     _IconBase
  532.     _IntuitionBase
  533.     _LayersBase
  534.     _MathBase
  535.     _MathIeeeDoubBasBase
  536.     _MathIeeeDoubTransBase
  537.     _MathTransBase
  538.     _PotgoBase
  539.     _RomBootBase
  540.     _TimerBase
  541.     _TranslatorBase
  542.  
  543.  
  544.  
  545. o    Unfortunately the leading underscores are necessary so you can use
  546.     includes without your assembler complaining.  Some library
  547.     bases ( IntuitionBase, ExecBase, GfxBase, ExpansionBase,
  548.     RomBootBase ) are already defined in some .i's resulting in
  549.     "multiply defined symbol" errors.
  550.  
  551. o    You might notice that ExecBase is missing.  It isn't needed.
  552.     ( it's loaded with "movea.l $4,a6" )
  553.  
  554.  
  555.                    Permit( )
  556.               OpenLibrary( "dos.library" 0 )
  557.                         ^ ^               ^
  558.                no space | | space         | space
  559.  
  560. o    The function name must be followed immediately with "(" ( no
  561.     spaces between ) and then followed by a space or tab.
  562.     If the function has no arguments, it still needs a space in
  563.     the middle.  Arguments must be separated with a space or tab.
  564.  
  565.  
  566.               ReturnVar = AllocMem( FSize $10001 )
  567.  
  568. o    All variables used in function calls, return variables or
  569.     function arguments, should be LONG.
  570.  
  571.  
  572.               a2 = ViewAddress( )
  573.               d1 = Read( "myfile" Buf BufLen )
  574.  
  575. o    Address or data registers can also be used for returns
  576.     if they're more convenient.
  577.  
  578.  
  579. Arguments:
  580.  
  581. o    If your argument is already in a DIFFERENT data or address register,
  582.     you can pass it as an argument directly.  Often a previous function
  583.     will put results in D0, so just pass d0.  If the proper
  584.     register is already loaded, just pass "*".
  585.  
  586.     ( if you pass it the same register it uses, it'll be skipped.
  587.     func defined as:  D0  Lock( D1 D2 )  "Flock = Lock( d1 -2 )"
  588.     arg "d1" will be skipped )
  589.  
  590.  
  591. o    EZAsm now supports argument strings surrounded by double quotes.
  592.     The following "C" character constants are supported:
  593.  
  594.         \b    backspace
  595.         \f    form feed
  596.         \n    newline
  597.         \r    carriage return
  598.         \t    horizontal tab
  599.         \v    vertical tab
  600.  
  601.  
  602.     examples:  
  603.  
  604.     "Hello, World!\n"
  605.     
  606.     "\t\tHeading\n"
  607.  
  608.  
  609.     Strings are automatically null terminated.
  610.  
  611.  
  612. o    To load a pointer to a newwindow or other "structure" you've
  613.     defined use: #newwindow   ( etc. ) it'll load its address into
  614.     a data or address register.
  615.  
  616. o    if you need a pointer to one of your declared variables
  617.     ( where the argument goes to an address register ) use:
  618.  
  619.         &foo   ( address of "foo" )
  620.  
  621.     ( output as "lea  foo(a5),An" )
  622.     ( "&" is ONLY recognized inside function arguments )
  623.  
  624. o    Sometimes you have to "play around" with using "#", "&", variables,
  625.     constants etc.  You might be giving it the contents of a variable,
  626.     when it needs its address ( etc. )
  627.   
  628.  
  629. All functions within these ( 1.3 ) libraries are supported:
  630.  
  631.     ConsoleDevice
  632.     DiskfontBase        
  633.     DOSBase
  634.     ExecBase  ( SysBase )
  635.     ExpansionBase
  636.     GfxBase
  637.     IconBase
  638.     IntuitionBase
  639.     LayersBase
  640.     MathBase
  641.     MathIeeeDoubBasBase
  642.     MathIeeeDoubTransBase
  643.     MathTransBase
  644.     PotgoBase
  645.     RomBootBase
  646.     TimerBase
  647.     TranslatorBase
  648.  
  649.  
  650. o    It keeps track of the current library base.  As long as no user
  651.     labels, or close braces ("}") are hit, it will skip reloading
  652.     the base register for functions which use the same
  653.     library base.
  654.  
  655. o    The file "funcnm" contains a list of every function that is
  656.     supported.
  657.  
  658.  
  659. **************************************************
  660.  
  661. Optimizations:
  662.  
  663.     Aside from the many "normal" optimizations performed on
  664.     statements, the following are also performed:
  665.  
  666.  
  667.   STATEMENT          BECOMES        NOTE
  668.  
  669.  
  670.    An = 0          sub.l An,An
  671.  
  672.    [B] = 0         clr [B]          1
  673.  
  674.  
  675.  ( compares )
  676.  
  677.    [B] = 0
  678.    [B] != 0        tst [B]
  679.                    bxx label
  680.  
  681.    ----------------------------------
  682.  
  683.    [B] += #
  684.    [B] -= #
  685.  
  686.    [B] &= #   
  687.    [B] |= #
  688.    [B] x= #
  689.  
  690.    [B] = #         moveq   #,d7     2
  691.                    [opr].l d7,[B]
  692.  
  693.  
  694.    ( compares )
  695.  
  696.    Dn <op> #       moveq   #,d7     2
  697.                    cmp.l   d7,dn
  698.                    bxx     label
  699.  
  700.    An <op> #       moveq   #,d7     2
  701.                    cmpa.l  d7,an
  702.                    bxx     label
  703.  
  704.    ----------------------------------
  705.  
  706.    Dn << 1-31
  707.    Dn >> 1-31                       3, 2
  708.  
  709.    An += #1        lea  n(An),An
  710.    An -= #1        lea  -n(An),An   4, 2
  711.  
  712.    An = #2         lea  n,An        5, 2
  713.  
  714.    Dn *= #1                         6
  715.  
  716.    
  717.  
  718. # = 1-127    ( #<4> if appropriate )
  719.  
  720. #1 = any byte or word length number
  721.  
  722. #2 = any byte, word, or long length number
  723.  
  724.  
  725.  
  726. Notes:
  727.  
  728. 1    For byte and word sizes the code size is smaller, for long,
  729.     its smaller and faster. ( then "move #0,[B]" )            
  730.  
  731. 2    Only apply to long sized operations.
  732.  
  733. 3    The resulting instructions are combinations of "swap", "clr.w",
  734.     "add.l", "lsr" or "lsl".
  735.  
  736. 4    ( 1-8 handled by "addq", "subq" )
  737.  
  738. 5    ( 0 handled by "sub.l An,An" )
  739.  
  740. 6    The resulting instructions are combinations of "move.l", "asl.l", 
  741.     "asr.l", "add.l".        
  742.  
  743.  
  744. ********************************************
  745.  
  746. General Info:
  747.  
  748.  
  749. o    Statements can be indented as you like.  Operands, operator,
  750.     and arguments must be separated by at least one space or tab. 
  751.  
  752. o    Braces can be nested up to 30 deep.
  753.     
  754. o    Only one statement per line.
  755.  
  756. o    If you declare variables or use function call's, the first statement
  757.     in your code must be an "EZAsm statement" so it knows when
  758.     to insert the XREF's and/or get stack frame for the
  759.     variables.  Comments, assembly directives, or assembly statements
  760.     placed between your variables and the start of your code will be
  761.     OUT OF PLACE in the output file.
  762.  
  763. o    Comments must begin with "*" or ";" and begin at column 1, or after
  764.     statements ( separated from last argument or operand ) using ";".
  765.     ( both types are transferred to output file ( some may not ))
  766.  
  767. o    Operands supported:  @141 (octal),  $61 (hex),  %1100001 (binary),
  768.     'a' (ASCII),  97  (decimal).  ASCII strings in operands can
  769.     contain a maximum of 4 characters.
  770.     ( no quotes within quotes permitted )    
  771.  
  772. o    To make labels and symbols as compatible as possible, they arn't
  773.     checked for illegal characters.  Typically the 1st character
  774.     must be a letter, underscore "_", or a period "." .
  775.     The rest of the characters can be any of these plus 0-9.
  776.  
  777. o    Labels and symbols are limited to a length of 127.
  778.     ( Check your assembler to find what length they're
  779.     significant to ( usually around 30))
  780.  
  781. o    Labels that don't begin at column 1 should be followed immediately
  782.     with ":".
  783.  
  784. o    Temporary labels of the form n$, where n consists of decimal
  785.     digit(s), are supported.  These labels are only in effect till
  786.     the next non-temporary label is encountered.  ( be careful
  787.     of "hidden" labels generated by braces )
  788.  
  789. o    No need to put in the usual "moveq #0,d0", "rts" at the end of your
  790.     code, its part of the closing block of code it inserts.
  791.  
  792. o    D7 is used as a scratch register for some optimizations, so be
  793.     careful if you use it.
  794.  
  795. o    Labels that it generates for braces are in the range
  796.     ".laaa" to ".lzzz" so try to avoid using them.
  797.     ( upper case is OK )
  798.  
  799. o    Constants generated from argument strings are in the range:
  800.     .c0 to .c0+n .  Matching strings are not duplicated.
  801.   
  802. o    "SP", "PC", "CCR", "SR" & "USP" are supported, but you must ensure
  803.     the size is legal as no checks are made.
  804.     ( must be upper case )
  805.  
  806. o    For best viewing of output file set your tabs to 8 spaces.
  807.     ( printing should be fine )
  808.  
  809.  
  810. IMPORTANT! :
  811.  
  812. Use of register A5 is RESERVED!
  813.  
  814. ( it contains the base address for variable storage )
  815.  
  816.  
  817. ********************************
  818.  
  819. Variable Declaration:
  820.  
  821.  
  822. LONG    foo Save[10] bar
  823. WORD    DMASave
  824. BYTE    Sw
  825.  
  826.  
  827. o    "xxx[n]" reserves n consecutive blocks of given size,
  828.     with "xxx" pointing to left-most byte.  In the future this
  829.     may be used for arrays.
  830.  
  831. o    You're limited to 14 variables per line.
  832.  
  833. o    No other statement types may occur between these lines.
  834.  
  835. o    Variables must be separated by at least one space, or tab.
  836.  
  837. o    To keep things word aligned, if an odd number of bytes are    
  838.     declared in BYTE, an extra byte will be added.  This
  839.     will offset the next "equ" by one.
  840.     ( in the case of "BYTE    Count foo buf[3]" ( 5 bytes )
  841.     an extra would be added )
  842.  
  843. o    Must occur JUST BEFORE your program code.
  844.  
  845. o    Must begin at 1st column, with LONG, WORD, or BYTE in upper case.
  846.  
  847. o    EZAsm uses "link" to allocate space for variables on the stack.
  848.     The maximum size of this space is 32K.  If you need large blocks of
  849.     memory use AllocMem( ).  Since this stack space contains "garbage"
  850.     code is added to clear it out before use.
  851.     ( A0 and D0 are not disturbed )
  852.  
  853.  
  854. What the stack frame looks like:
  855.  
  856.  
  857. LONG    foo
  858. WORD    bar Total
  859. LONG    Cnt
  860.  
  861.  
  862. becomes...
  863.  
  864. foo    equ  -4
  865. bar    equ  -6
  866. Total  equ  -8
  867. Cnt    equ  -12
  868.  
  869.  
  870.         h  l           A5   base register
  871.         i  o           |
  872.         OOOO OO OO OOOOO    memory bytes
  873.   (-)   1119 87 65 4321
  874.         210
  875.  
  876.  
  877.  
  878. ( Sometimes variables are "adjusted" for proper loading, and
  879. "-2(a5)" or other displacement may appear in the output file
  880.  instead of "foo(a5)" or other variable you might be expecting. )
  881.  
  882.  
  883. ************************************************
  884.  
  885. How to get what you need, hints, etc.:
  886.  
  887.  
  888. END
  889.     A68k only allows 2 "sections" of code. ( 1 CODE & 1 DATA )
  890.     This means you can only have 1 DATA section, on top or
  891.     below.  The DATA section is used here at the bottom, so all  
  892.     your data ( "dc.b", "ds.l" etc. ) should be placed BELOW the
  893.     END statement.  Any string constants which are generated will
  894.     also appear below the END.  In the final output file "END" will
  895.     be adjusted, and everything will work out.
  896.     ( EQU, XREF, XDEF etc. can go above your code with no problem )
  897.  
  898. o    Instruction size:  In most cases you won't need
  899.     a size argument.  It knows the size of the variables,
  900.     address and data registers, and is smart enough to know
  901.     what size to use.  It determines the size of data by it's
  902.     actual value not its physical size.
  903.     ( $0020  %11010000  $12  125  are all BYTE size )
  904.     If the data is smaller than the instruction size you want,
  905.     ( d1 = $20 w ) or it can't know an operands size
  906.     ( (a2)+ = 3(a0) l ) you'll need to give it a size argument.
  907.  
  908.     Caution:  Be aware that if you load small variables into
  909.           larger ones, the upper bytes arn't cleared and
  910.           may garbage your result.  Always initialize your
  911.           variables or restrict the size of the operation to
  912.           "b" or "w".
  913.  
  914. o    Since "(a1)" refers to the CONTENTS of the byte, word, or long
  915.     that A1 points to, "($dff180)" is used in a similar way.
  916.     "move.w  $dff01e,d0" would become, "d0 = ($dff01e) w".
  917.     ( decimal addr's are also valid: "(123)" )
  918.  
  919. o    When numbers are used as operands "$fe02" or "37", they are
  920.     converted to "#$fe02" and "#37".  When "$2f(a2)" or "15(a0)"
  921.     type operands are used, they are left as is. ( see below )
  922.  
  923. o    Operands that it doesn't recognize ( doesn't match with any
  924.     declared LONG, WORD, BYTE, or standard "(a1)+" etc. ) get
  925.     output as is.  This is very useful when you need operands
  926.     like: "#intuiname", "wd_UserPort(a1)", "$20(a1)", "DMACON(a6)"
  927.  
  928. o    Most instructions set condition code flags on the result of the
  929.     operation.  Often, instead of using a compare to check the
  930.     result, you can use a branch on condition instruction "beq",
  931.     "bne" etc. to jump to a location on the state of a condition
  932.     code flag.  You need to check which flags are set ( if any )
  933.     for an instruction.
  934.  
  935. o    If at any time you're unsure of what a statement is being
  936.     output as, or want to check something out, just look
  937.     at the output file.  Well placed blank lines in your source
  938.     code can enhance its readability.
  939.  
  940. o    I think it's a good idea to get away from using include files.
  941.     It speeds up the assembler tremendously.  Most assembly
  942.     source files I see do this.
  943.  
  944.  
  945. ****************************************
  946.  
  947. Errors:
  948.  
  949.  
  950. "Illegal argument"
  951.  
  952.     The argument found was not valid for the operator.  See
  953.     the list of "Optional Args" for the operator.  It must
  954.     be lower case, and be separated from the operands
  955.     by at least a space or a tab.
  956.     
  957. "Illegal operand"
  958.  
  959.     One, or both, of the operands are:  not valid for the operator,
  960.     have an invalid number, or byte size was specified for an
  961.     "An" operand ( {B} ).  In most cases it's looking for "Dn" or "An"
  962.     as one of the operands.  ( look under the "legal operands"
  963.     of the operator for a valid combination )
  964.  
  965. "Illegal size"
  966.  
  967.     The argument size you specified is not valid for the operator.    
  968.     Check the "legal sizes" for the operator.
  969.     
  970. "Needs size argument"    
  971.  
  972.     It doesn't have enough size information about the operands to
  973.     calculate an instruction size.
  974.     You need to add an l, w, or b argument.
  975.  
  976. "Label not found"
  977.  
  978.     No label matching your label argument was found.    
  979.  
  980. "Brace mismatch"
  981.  
  982.     Checks are made when a closing brace ( "}" ) is hit, and when "END"
  983.     is hit.  If the brace stack is "messed up" at that time, an error 
  984.     is given.  If "}" is shown, look from there up.  Both "}" and "END"
  985.     may appear.  If just "END", look for a "{" or "} else {" without a
  986.     matching "}".
  987.  
  988. "Function not found"
  989.  
  990.     No function matching your function name was found.  Check case and    
  991.     spelling of function name, and be sure there isn't a space before
  992.     the "(".  Check the list of supported function names in the
  993.     file "funcnm".
  994.  
  995. "Function argument count incorrect"
  996.  
  997.     Check the number of arguments you used for the function.  Too many
  998.     or not enough were used.  With string arguments, check for
  999.     a missing '"'.  Also look for a missing end ")".
  1000.  
  1001.  
  1002. ( EZAsm doesn't do much checking of normal assembly statements.
  1003. A68k and Blink will catch any problems missed by EZAsm and bring
  1004. them to your attention )
  1005.  
  1006.  
  1007. *******************************************************************
  1008. *******************************************************************
  1009.  
  1010.  
  1011.     If you try it, I think you'll like it. 8^)
  1012.     I'm always trying to improve EZAsm, and I'd really like
  1013.     to hear any ideas you have on making it better,
  1014.     even your complaints.  So if you've found an
  1015.     "undocumented feature", or there's something you'd like
  1016.     to see in a future version please let me know.
  1017.  
  1018.     Enjoy!
  1019.  
  1020.  
  1021. You can reach me at:
  1022.  
  1023. Joe Siebenmann
  1024. 8303 Old Tree Court
  1025. Springfield, VA  22153
  1026. (703) 455-4982
  1027.  
  1028. or
  1029.  
  1030. PLINK:    IGZ798
  1031.  
  1032. ( please leave any messages in my mailbox )
  1033.  
  1034.  
  1035.